﻿using SuperJoe.Framwork.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WWX.MemberPortal.BLL;
using WWX.MemberPortal.Web.Models;

namespace WWX.MemberPortal.Web.Controllers
{
    public class MemberController : AuthorizationController
    {
        public ActionResult Index()
        {
            var bill = new MemberBLL();
            var member = bill.Get(this.CurrentUser.Id);
            return View(member);
        }

        public JsonResult UpdatePwd(PwdChangeVM vm)
        {
            vm.Validate();

            var memberBll = new MemberBLL();
            memberBll.UpdatePwd(this.CurrentUser.Account, vm.OldPwd, vm.NewPwd);

            return this.CreateRichJsonResult();
        }
    }
}